﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using RuleCode.Table;

namespace ERPWebDemos.Forms.SingleTable
{
    public partial class SingleTableEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (ValidateParams() == false)
            //{
            //    return;
            //}

            //if (!IsPostBack)
            //{
            //    BindData();
            //}
        }
        /// <summary>
        /// 验证参数
        /// </summary>
        /// <returns></returns>
        protected bool ValidateParams()
        {
            bool result = true;
            result &= ((Request["type"] == "add") || (Request["type"] == "edit" && Request["recid"] != null));
            return result;
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void BindData()
        {
            //if (Request["type"] == "add")
            //{
            //    UpdateButton.Text = "增加";
            //    Users u = new Users();
            //    RuleGroup1.SetTableFieldGroup(u, "");
            //}
            //else if (Request["type"] == "edit")
            //{
            //    UpdateButton.Text = "修改";
            //    Users u = Users.Find("RECID=" + Request["recid"]);
            //    RuleGroup1.SetTableFieldGroup(u, "");

            //}
        }

        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            //if (Request["type"] == "add")
            //{
            //    Users u = new Users();
            //    u.New();
            //    RuleGroup1.GetTableFieldGroupValue(u);
            //    u.Modify();
            //}
            //else if (Request["type"] == "edit")
            //{
            //    Users u = Users.Find("RECID=" + Request["recid"]);
            //    RuleGroup1.GetTableFieldGroupValue(u);
            //    u.Modify();

            //}
            //ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "refresh", "<script type='text/javascript'>refreshParent();</script>", false);

        }
        
    }
}
